package com.ihelp.rest.mis.pojo;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 * 角色
*      
* 类名称：Role   
* 类描述：     
* 创建时间：2013-3-13 下午04:03:45    
* 备注：   
* @version
 */
@Entity
@Table(name = "ROLE")
public class Role implements Serializable{
	
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "guid")
	@Column(name = "UUID", length = 36)
	private String uuid;
	
	@Column(name = "NAME", length = 40)
	private String name;
	
	@ManyToMany(cascade={CascadeType.ALL})
	@LazyCollection(LazyCollectionOption.FALSE)
	@JoinTable(name="ROLE_MODULE",joinColumns={@JoinColumn(name="ROLE_UUID")},inverseJoinColumns={@JoinColumn(name="MODULE_UUID")})
	@Fetch(FetchMode.SUBSELECT)
	private List<Module> modules;
	
	public List<Module> getModules() {
		return modules;
	}

	public void setModules(List<Module> modules) {
		this.modules = modules;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
}
